// pages/order/order.js
Page({
  data: {
    tab:[
      {title:"全部",isactive:false},
      {title:"待付款",isactive:false},
      {title:"待收货",isactive:false},
      {title:"退款/退货",isactive:false}
    ],
    activeIndex:0,
  },
  onLoad: function (options) {
    const {type} = options;
    const activeIndex = Number(type) - 1;
    this.data.tab[activeIndex].isactive = true;
    this.setData({tab:this.data.tab})
    this.setData({activeIndex})
    this.getOrders()
  },
  tabClick(data){
    const {index} = data.detail;
    this.setData({activeIndex:index});
  },
  getOrders(){
    var reqTask = wx.request({
      url: 'https://api-hmugo-web.itheima.net/api/public/v1/my/orders/all',
      data: {type:1},
      header: {'content-type':'application/json'},
      success: (result) => {
        console.log(result)
      },
    });
      
  }
})